MkTable
:fa-brands-github: Show source on GitHub
Class representing a formatted table.¶
Description
Data: a mapping column -> cells, a list of rows (the first one is the header unless
columns are given) or a list of dicts (see MkBaseTable). | in cells gets escaped.
Example: Regular¶
| Column A | Column B |
|---|---|
| A | C |
| B | D |
| C | E |
Example: From rows (the first one is the header unless columns are given)¶
| Name | Value |
|---|---|
| a|b | 1 |
| c | 2 |
Example: From list of dicts¶
| col 1 | col 2 |
|---|---|
| abc | cde |
| fgh | ijk |
| Name | Children | Inherits |
|---|---|---|
| MkDependencyGroups mknodes.templatenodes.mkdependencygroups Node to display optional dependencies or dependency groups as a table. |
| Name | Children | Inherits |
|---|---|---|
| MkBaseTable mknodes.basenodes.mkbasetable Base Class for MkTables. Only deals with managing the data. |
graph TD
1430734008["mktable.MkTable"]
3678415322["mkbasetable.MkBaseTable"]
835538629["mkcontainer.MkContainer"]
1956333208["mkcontainer.MkContainerBase"]
1359323199["mknode.MkNode"]
2751680898["builtins.object"]
3678415322 --> 1430734008
835538629 --> 3678415322
1956333208 --> 835538629
1359323199 --> 1956333208
2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/mknodes/basenodes/mktable/metadata.toml
[metadata]
icon = "octicon:table-24"
name = "MkTable"
[requirements.extension.tables]
[examples.regular]
title = "Regular"
jinja = """
{{ {"Column A": ["A", "B", "C"], "Column B": ["C", "D", "E"]} | MkTable }}
"""
[examples.rows]
title = "From rows (the first one is the header unless `columns` are given)"
jinja = """
{{ [["Name", "Value"], ["a|b", "1"], ["c", "2"]] | MkTable }}
"""
[examples.list_of_dicts]
title = "From list of dicts"
jinja = """
{{ [{"col 1": "abc", "col 2": "cde"}, {"col 1": "fgh", "col 2": "ijk"}] | MkTable }}
"""
# [output.markdown]
# template = """
# {% for k in table_data.keys() %}
# {% endfor %}
# {% for row in self.iter_rows() %}
# {% endfor %}
# """